
#ifndef _AbstractCmdManager_H_
#define _AbstractCmdManager_H_


#include "CoreApi.hpp" 
#include "AbstractCommand.hpp"
#include <QString>

namespace NSCore {


	class COREAPI AbstractCmdManager :
		public QObject,
		public AbstractObject 
	{
		Q_OBJECT 
	protected:
		QVector<NSCore::AbstractCommand*> m_undostack;  // ����ջ 
		QVector<NSCore::AbstractCommand*> m_redostack;  // ����ջ 

	public:
		AbstractCmdManager();
		virtual ~AbstractCmdManager();
		
	public: 
		virtual bool canUndo() const { return !m_undostack.isEmpty(); }
		virtual bool canRedo() const { return !m_redostack.isEmpty(); }

		virtual int getUndoStackSize() { return m_undostack.size(); };
		virtual int getRedoStackSize() { return m_redostack.size(); };  

		virtual void execute(NSCore::AbstractCommand* cmd, bool append = true);
		virtual bool undo();
		virtual bool redo();


		virtual inline QString className() override { return "AbstractCmdManager"; };
		

	};

}

#endif // !_ABS_FACTORY_H_
